using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_ippaymentsMap : EntityTypeConfiguration<so_ippayments>
    {
        public so_ippaymentsMap()
        {
            // Primary Key
            this.HasKey(t => new { t.ID, t.Date, t.Closedout, t.sumfields, t.dimfields });

            // Properties
            this.Property(t => t.ID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Type)
                .HasMaxLength(11);

            this.Property(t => t.document_type)
                .HasMaxLength(7);

            this.Property(t => t.Vendor)
                .HasMaxLength(35);

            this.Property(t => t.Vendor__)
                .HasMaxLength(6);

            this.Property(t => t.Created_By)
                .HasMaxLength(30);

            this.Property(t => t.Batch)
                .HasMaxLength(10);

            this.Property(t => t.account__)
                .HasMaxLength(20);

            this.Property(t => t.Cur)
                .HasMaxLength(5);

            this.Property(t => t.Cash_account)
                .HasMaxLength(20);

            this.Property(t => t.CC__Check_)
                .HasMaxLength(20);

            this.Property(t => t.CC_Type)
                .HasMaxLength(20);

            this.Property(t => t.CC_Expiry)
                .HasMaxLength(4);

            this.Property(t => t.Master_)
                .HasMaxLength(8);

            this.Property(t => t.sumfields)
                .IsRequired()
                .HasMaxLength(27);

            this.Property(t => t.dimfields)
                .IsRequired()
                .HasMaxLength(31);

            // Table & Column Mappings
            this.ToTable("so_ippayments");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.document_type).HasColumnName("document_type");
            this.Property(t => t.Date).HasColumnName("Date");
            this.Property(t => t.Vendor).HasColumnName("Vendor");
            this.Property(t => t.Vendor__).HasColumnName("Vendor_#");
            this.Property(t => t.Created_By).HasColumnName("Created_By");
            this.Property(t => t.Batch).HasColumnName("Batch");
            this.Property(t => t.account__).HasColumnName("account_#");
            this.Property(t => t.Cur).HasColumnName("Cur");
            this.Property(t => t.AMOUNT).HasColumnName("AMOUNT");
            this.Property(t => t.Amount_Base1).HasColumnName("Amount_Base1");
            this.Property(t => t.Amount_Base2).HasColumnName("Amount_Base2");
            this.Property(t => t.Cash_account).HasColumnName("Cash_account");
            this.Property(t => t.CC__Check_).HasColumnName("CC#_Check#");
            this.Property(t => t.CC_Type).HasColumnName("CC_Type");
            this.Property(t => t.CC_Expiry).HasColumnName("CC_Expiry");
            this.Property(t => t.Master_).HasColumnName("Master#");
            this.Property(t => t.Closedout).HasColumnName("Closedout");
            this.Property(t => t.sumfields).HasColumnName("sumfields");
            this.Property(t => t.dimfields).HasColumnName("dimfields");
        }
    }
}
